Class Unifier

java.lang.Object
edu.uky.ai.lp.logic.Unifier
All Implemented Interfaces:
java.lang.Cloneable

public class Unifier
extends java.lang.Object
implements java.lang.Cloneable
A unifier tracks which variable are equal to one another and which variable are equal to constants.
Author:
Stephen G. Ware
  • Constructor Summary

    Constructors 
    Constructor Description
    Unifier()
    Constructs an empty unifier.
  • Method Summary

    Modifier and Type Method Description
    Unifier clone()  
    Term get​(Variable variable)
    Returns the value assigned to a variable (if any) under this unifier.
    Unifier set​(Variable variable, Term value)
    Sets a variable equal to a value (if value is a constant) or as having the same value as another variable (if value is a variable).
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Unifier

      public Unifier()
      Constructs an empty unifier.
  • Method Details

    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • clone

      public Unifier clone()
      Overrides:
      clone in class java.lang.Object
    • get

      public Term get​(Variable variable)
      Returns the value assigned to a variable (if any) under this unifier.
      Parameters:
      variable - the variable
      Returns:
      the value assigned to the variable (if any)
    • set

      public Unifier set​(Variable variable, Term value)
      Sets a variable equal to a value (if value is a constant) or as having the same value as another variable (if value is a variable). Note that this object is not modified; a new unifier is returned.
      Parameters:
      variable - the variable to set
      value - the value to set it to
      Returns:
      the resulting unifier, or null if the variable cannot be set to that value